package com.zhangj.config;

import com.zhangj.interceptor.MyInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @ClassName MVCConfig
 * @Description
 * @Author zhangjie
 * @Date 2022/1/11 17:45
 * @Version 1.0
 */

@SpringBootConfiguration
public class MVCConfig implements WebMvcConfigurer {

    @Autowired
   private MyInterceptor myInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(myInterceptor).addPathPatterns("/**");
    }
}
